﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Menu.Master" AutoEventWireup="true" CodeBehind="OrdenProduccionList.aspx.cs" Inherits="Emporium_Web.OrdenProduccionList" Theme="Constellation" %>

<%@ MasterType VirtualPath="~/Menu.master" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<%@ Register TagPrefix="emporium" TagName="ClienteSearch" Src="~/Search/ClienteSearch.ascx" %>
<%@ Register TagPrefix="emporium" TagName="TemporadaSearch" Src="~/Search/TemporadaSearch.ascx" %>
<%@ Register src="Search/VarianteAdd.ascx" tagname="VarianteAdd" tagprefix="uc1" %>
<%@ Register src="Search/EstiloAdd.ascx" tagname="EstiloAdd" tagprefix="uc2" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <title>Listado de Estilos</title>
    <script type="text/javascript">
        var hdnSeleccionId = '<%= this.hdnSeleccion.ClientID %>';
    </script>
    <script type="text/javascript" src="js/funciones.grid.js"></script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <!-- Content -->
    <article class="container_12">
		<section class="grid_12">
			<div class="block-border">
			<form runat="server" class="block-content form" id="table_form">
            <ajaxToolkit:ToolkitScriptManager ID="toolk" runat="server">
</ajaxToolkit:ToolkitScriptManager>
				<h1>Orden de Producción</h1>

                <div style="width: 100%; padding-top: 20px;">
                    <div style="width: 100%; height: 45px; float: inherit;">
                        <div style="width: 100px; float: left;">
                            <label>
                                    Nro O.P.</label>
                        </div>
                        <div align="left" style="width: 70%; float: left;">
                            <asp:TextBox ID="txtCodigo" name="simple-required" runat="server" Width="100px" Style="text-align:right;" onKeyPress ='return ValidarInputNumerico(event)'></asp:TextBox>
                        </div>
                    </div>     
                    
                    
                    <div style="width: 100%; height: 45px; float: inherit;">
                        <div style="width: 100px; float: left;">
                            <label>
                                  Cliente</label>
                        </div>
                        <div align="left" style="width: 70%; float: left;">
                            <emporium:ClienteSearch ID="clienteSearch" runat="server" EnabledTextBox ="true" />
                        </div>
                    </div>    
                    
                    
                     <div style="width: 100%; height: 45px; float: inherit;">
                        <div style="width: 100px; float: left;">
                            <label>
                                   Nro Estilo</label>
                        </div>
                        <div align="left" style="width: 40%; float: left; text-align:left;">                              
                            <asp:TextBox ID="txtCodigoEstilo" runat="server" Width="20%" Style="text-align:right;" onKeyPress ='return ValidarInputNumerico(event)'></asp:TextBox>         
                            <asp:Button ID="btnBuscarEstilo" runat="server" Text="..."  CssClass="button" 
                                CausesValidation="false" onclick="btnBuscarEstilo_Click"/>
                            
                            <uc2:EstiloAdd ID="estiloAdd" runat="server" OnagregarClick ="estiloAdd_Seleccionado"/>
                            
                        </div>
                        <div align="left" style="width: 20%; float: left; text-align:left;">
                             <asp:LinkButton ID="LinkButton1" runat="server" Text="Buscar" CssClass="button red" OnClick="btnBuscar_Click" />
                        </div>
                    </div>   
                   
                 </div>

                 
                    <asp:HiddenField ID="hdnSeleccion" runat="server" />
                  
                   <div style="width: 100%;">
					<ul class="message error no-margin" runat="server" id="errorMessage">
					    <li><asp:Label runat="server" ID="lblErrorMessage"></asp:Label></li>
					</ul>
                    <ul class="message warning no-margin" runat="server"  id="warningMessage">
					    <li><asp:Label runat="server" ID="lblWarningMessage"></asp:Label></li>
					</ul>                   
                   </div>
                                      

                    <div class="block-controls">
                        <emporium:pager ID="gvPager" runat="server" Visible="false" PageSize="5" OnPageChanged="gvPagerPageChanged" />
                    </div>
                    <div class="no-margin">
					 <asp:GridView ID="gvOrdenesProduccion" runat="server" SkinID="gridviewSkin" 
                            PageSize="5" Width="100%" onrowdatabound="gvOrdenesProduccion_RowDataBound" 
                            onrowcommand="gvOrdenesProduccion_RowCommand">
						<Columns>                   
                            
							<asp:TemplateField>
                                <ItemTemplate>
                                      <input id="rbSelect" type="radio" name="selectGroup" value="rbSelect" onclick="javascript:Check('<%# Eval("OrdPro_Id") %>');"/>
								</ItemTemplate>
								<ItemStyle HorizontalAlign="Left" Width="2%" />
							</asp:TemplateField>
                             <asp:TemplateField>
                                <HeaderStyle HorizontalAlign="Left" ForeColor="White" Font-Bold="true"></HeaderStyle>
                                <HeaderTemplate>
                                <span class="column-sort">
									<asp:LinkButton Name="lnkSortUpId" ID="lnkSortUpId" CssClass="sort-up" runat="server" CommandName="SortUp" CommandArgument="Id"/>
                                    <asp:LinkButton Name="lnkSortDownId" ID="lnkSortDownId" CssClass="sort-down" runat="server"  CommandName="SortDown" CommandArgument="Id"/>
								</span>
                                Nro O.P.
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <asp:LinkButton ID="btnConsultar" runat="server" Text='<%# Bind("OrdPro_Id","{0:00000}") %>' OnClick="btnConsultar_Click"  />
								</ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField>
                                <HeaderStyle ForeColor="White" Font-Bold="true"></HeaderStyle>
                                <HeaderTemplate>
                                    <span class="column-sort">
									    <asp:LinkButton ID="lnkSortUpDescripcion" CssClass="sort-up" runat="server" CommandName="SortUp" CommandArgument="Descripcion"/>
                                        <asp:LinkButton ID="lnkSortDownDescripcion" CssClass="sort-down" runat="server"  CommandName="SortDown" CommandArgument="Descripcion"/>
								    </span>
                                   Descripción
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <%# Eval("OrdPro_Descripcion")%>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField>
                                <HeaderStyle ForeColor="White" Font-Bold="true"></HeaderStyle>
                                <HeaderTemplate>
                                    <span class="column-sort">
									    <asp:LinkButton ID="lnkSortUpCliente" CssClass="sort-up" runat="server" CommandName="SortUp" CommandArgument="Cliente"/>
                                        <asp:LinkButton ID="lnkSortDownCliente" CssClass="sort-down" runat="server"  CommandName="SortDown" CommandArgument="Cliente"/>
								    </span>
                                   Cliente
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <%# Eval("TG_Cliente.Nombre")%>
                                </ItemTemplate>
                            </asp:TemplateField>
                             <asp:TemplateField>
                                <HeaderStyle ForeColor="White" Font-Bold="true"></HeaderStyle>
                                <HeaderTemplate>
                                    <span class="column-sort">
									    <asp:LinkButton ID="lnkSortUpEstilo" CssClass="sort-up" runat="server" CommandName="SortUp" CommandArgument="Estilo"/>
                                        <asp:LinkButton ID="lnkSortDownEstilo" CssClass="sort-down" runat="server"  CommandName="SortDown" CommandArgument="Estilo"/>
								    </span>
                                   Estilo
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <%# Eval("Estilo_Id","{0:00000}")%>
                                </ItemTemplate>
                            </asp:TemplateField>
                             <asp:TemplateField>
                                <HeaderStyle ForeColor="White" Font-Bold="true"></HeaderStyle>
                                <HeaderTemplate>
                                    <span class="column-sort">
									    <asp:LinkButton ID="lnkSortUpVariante" CssClass="sort-up" runat="server" CommandName="SortUp" CommandArgument="Variante"/>
                                        <asp:LinkButton ID="lnkSortDownVariante" CssClass="sort-down" runat="server"  CommandName="SortDown" CommandArgument="Variante"/>
								    </span>
                                   Variante
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <%# Eval("DE_Variante.Variante_Secuencia", "{0:000}")%>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField>
                                <HeaderStyle ForeColor="White" Font-Bold="true"></HeaderStyle>
                                <HeaderTemplate>
                                    <span class="column-sort">
									    <asp:LinkButton ID="lnkSortUpEstado" CssClass="sort-up" runat="server" CommandName="SortUp" CommandArgument="Estado"/>
                                        <asp:LinkButton ID="lnkSortDownEstado" CssClass="sort-down" runat="server"  CommandName="SortDown" CommandArgument="Estado"/>
								    </span>
                                   Estado
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="lblEstado" runat="server" Text='<%# Eval("OrdPro_Estado") %>' ></asp:Label>                                      
                                </ItemTemplate> 
                            </asp:TemplateField>                            
                            <asp:TemplateField HeaderText="F.Registro"  HeaderStyle-HorizontalAlign="Left">                                
                                <ItemTemplate> 
                                    <asp:Label ID="lblFechaRegistro" runat="server" Text='<%# Bind("OrdPro_FechaRegistro","{0:dd/MM/yyyy}") %>'></asp:Label> 
                                </ItemTemplate> 
                            </asp:TemplateField> 
                            <asp:TemplateField HeaderText="F.Objetivo"  HeaderStyle-HorizontalAlign="Left">                                
                                <ItemTemplate> 
                                    <asp:Label ID="lblFechaObjectivo" runat="server" Text='<%# Bind("OrdPro_FechaObjetivo","{0:dd/MM/yyyy}") %>'></asp:Label> 
                                </ItemTemplate> 
                            </asp:TemplateField>                                                   
                             <asp:TemplateField HeaderText="Tot.Sol."  HeaderStyle-HorizontalAlign="Left">                                
                                 <ItemTemplate>
                                    <asp:Label ID="lblPrendasSol" runat="server"></asp:Label> 
                                </ItemTemplate>
                            </asp:TemplateField>
                             <asp:TemplateField HeaderText="Tot.Prod."  HeaderStyle-HorizontalAlign="Left">                                
                                 <ItemTemplate>
                                    <asp:Label ID="lblPrendasProd" runat="server"></asp:Label> 
                                </ItemTemplate>
                            </asp:TemplateField>
						</Columns>  
						<PagerSettings Visible="false" />
					</asp:GridView>
				 </div>
                <ul class="message no-margin">
                    <li>
                        <asp:Label ID="lblMensajeGridFooter" runat="server"></asp:Label>
                    </li>
				</ul>
				<div class="block-footer">
                    <img src="images/icons/fugue/arrow-curve-000-left.png" width="16" height="16" class="picto"> 
                    <asp:LinkButton ID="btnAdicionar" runat="server" Text="Adicionar" CssClass="button" onclick="btnAdicionar_Click" />
				    <asp:LinkButton ID="btnModificar" runat="server" Text="Modificar" CssClass="button" onclick="btnModificar_Click" />
					<asp:LinkButton ID="btnEliminar" runat="server" Text="Eliminar" CssClass="button" onclick="btnEliminar_Click" OnClientClick="return DeleteRegistro();"/>                   					
                </div>
			</form>
			</div>
		</section>
	</article>

     <script type="text/javascript">

         function ValidarInputNumerico(e) {
             var valid = "0123456789"
             return ValidaInput(valid, e);
         }


         function ValidaInput(valid, e) {
             var keyAscii = (document.all) ? event.keyCode : e.which;
             if (keyAscii != 13) {
                 var key = String.fromCharCode(keyAscii);
                 var keyAj = key.toUpperCase();
                 if (valid == '') {
                     return true;
                 }
                 if (valid.indexOf(keyAj) == "-1") {
                     if (keyAscii != 8 && keyAscii != 0) { return false };
                     return true;
                 }
                 return true;
             }
         }

    </script>
</asp:Content>
